"""

"""
from selenium.webdriver.common.by import By

from we_com.pages.base_page import BasePage


class SchedulePage(BasePage):
    __add_button = (By.CSS_SELECTOR, '.addButton')
    __name = (By.CSS_SELECTOR, '[placeholder="输入名称"]')
    __description = (By.CSS_SELECTOR, 'textarea[placeholder="输入描述"]')
    __conform = (By.CSS_SELECTOR, '.wwui_button__Blue')
    __concel = (By.CSS_SELECTOR, '.wwui_uiedit_dialog_foot>a:nth-child(2)')
    __add_member = (By.CSS_SELECTOR, '.addText')
    __message = (By.CSS_SELECTOR, '#js_tips')

    def add_schedule(self, schedule_name, schedule_dexcription):
        self.click_visibility(self.__add_button)
        self.click_presence(self.__name)
        self.input_visibility(self.__name, schedule_name)
        self.input_visibility(self.__description, schedule_dexcription)
        # self.click_visibility(self.__add_member)
        return self

    def add_schedule_success(self):
        return self.click_and_is_miss(self.__conform)

    def add_schedule_err(self):
        self.click(self.__conform)
        msg = self.get_text(self.__message)
        self.click(self.__concel)
        return msg
